Electric vehicles have gained traction in recent years as a new mode of transportation, and as an alternative to gasoline vehicles dependent on oil—a finite natural resource. It is well-known that a main source of power in the electric vehicle comes from the stored energy in a battery pack. The performance of the battery pack, however, is highly dependent on the external environment, in particular, the temperature of the surroundings. For example, when the surrounding temperature is sub-zero 20 degree centigrade, the discharge performance of a lithium battery deteriorates, and the battery may not function properly as a power source. As a result, the electric vehicle may not operate normally in cold climates and may even fail to start. In order to solve the above problems, a battery heating device is used to heat the battery pack so that the temperature of the battery can reach the minimum temperature for the electric vehicle to operate in cold climates.
Typically, the heating of the battery can be accomplished using a battery heating module driven by a Pulse-Width Modulation (PWM) wave. But first, the PWM wave has to be reliably detected during operation of the battery pack. The prior art generally discloses using a hardware circuit to detect the PWM wave. However, the hardware circuit disclosed in the prior art usually only detects the electric level of the PWM wave, for example, whether the PWM wave is at a high electric level or a low electric level, but may not be able to determine a duty ratio of the PWM wave.